package com.yupi.usercenter.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;

@Configuration
@EnableSwagger2WebMvc
public class knif4swagger {
    @Bean
    public Docket defaultApi2()  {
        return new Docket(DocumentationType.SWAGGER_2)
                .groupName("webApi")
                .apiInfo(apiInfo())
                .select()
                //注释掉是为了acl不然不会显示
                //.paths(Predicates.not(PathSelectors.regex("/admin/.*")))
                .apis(RequestHandlerSelectors.basePackage("com.yupi.usercenter.controller"))
                .paths(PathSelectors.any())
                .build();
    }
    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("焦佳启用户中心")
                .description("本文档描述了服务接口定义")
                .version("1.0")
                .contact(new Contact("Helen", "https://www.bilibili.com/video/BV1dQ4y1A75e?p=25",
                        "1293076287@qq.com"))
                .version("1.0")
                .build();
    }
}



